import Vuex from 'vuex'
import Vue from 'vue'
Vue.use(Vuex)
import {
    childRouter
} from './module/childRouter'
import {
    native
} from './module/native'

// 这是新加的测试模块

export default new Vuex.Store({
    modules: {
        childRouter: childRouter,
        native: native
    },

    state: {
        userInfo: null
    },
    mutations: {
        getInfoData(state, value) {

            state.userInfo = value;
            // state.userInfo.navList.unshift({
            //     path: '/404',
            //     name: 'error'

            // })
            // setTimeout(() => {
            //     state.userInfo.navList.shift()
            // }, 2000)
            let data = JSON.stringify(value)
            window.localStorage.setItem(`userInfo`, data)
            console.log(`store已经获取到`, state.userInfo)
        }

    },
    action: {
        setInfoData(state) {
            // state.userInfo.navList.shift()
        }
    }
})
